﻿using VigenereCipher.Models;

namespace VigenereCipher
{
    /// <summary>
    /// 维吉尼亚密码测试
    /// </summary>
    internal class Program
    {

        static void Main(string[] args)
        {
            int pattern;
            pattern = 1;
            do
            {
                Console.WriteLine("维吉尼亚密码：请选择模式:(1-加密，2-解密，3-退出：):");
                pattern = Convert.ToInt32(Console.ReadLine());
                switch (pattern)
                {
                    //加密过程
                    case 1:
                        Console.Write("请输入明文：");
                        string encryInput = Console.ReadLine();
                        Console.Write("请输入密钥:");
                        string encryKey = Console.ReadLine();
                        EncryModel myEncode = new EncryModel();
                        myEncode.EncryPlainText = encryInput;
                        myEncode.EncryKey = encryKey;
                        myEncode.Encode();
                        Console.WriteLine($"加密后的密文:{myEncode.EncryCipher}");
                        break;
                    //解密过程
                    case 2:
                        Console.Write("请输入密文：");
                        string decryInput = Console.ReadLine();
                        Console.Write("请输入密钥:");
                        string decryKey = Console.ReadLine();
                        DecryModel myDecode = new DecryModel();
                        myDecode.DecryPlainText = decryInput;
                        myDecode.DecryKey = decryKey;
                        myDecode.Decode();
                        Console.WriteLine($"解密后的明文:{myDecode.DecryCipher}");
                        break;
                    case 3:
                        Console.Write("退出");
                        break;
                }
            } while (pattern == 1 || pattern == 2);
        }

    }
}